package com.nlx.notes.module.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nlx.notes.module.bean.dto.gold.GoldPurchasePageDTO;
import com.nlx.notes.module.bean.dto.gold.GoldPurchaseSelectListDTO;
import com.nlx.notes.module.entity.GoldPurchaseEntity;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;

public interface GoldPurchaseServiceMapper extends BaseMapper<GoldPurchaseEntity> {



    long countByCondition(GoldPurchasePageDTO goldPurchasePageDTO);

    List<GoldPurchaseEntity> pageByCondition(GoldPurchasePageDTO goldPurchasePageDTO);

    List<GoldPurchaseEntity> selectListByCondition(GoldPurchaseSelectListDTO goldPurchaseSelectListDTO);

    @Select("select sum(weight) from  gold_purchase where user_id = #{userId} and del_flag = 0 ")
    BigDecimal sumWeightByUser(Long userId);

    @Select("select sum(total_price) from  gold_purchase where user_id = #{userId} and del_flag = 0 ")
    BigDecimal sumTotalPriceByUser(Long userId);
}
